<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
<ui:composition template="main.xhtml">
	<ui:define name="title">
		<h:outputText value="#{Lang.prop[MySession.l]['useradmin']}" />
	</ui:define>
	<ui:define name="body">
		<rich:tabPanel id="tab" switchType="client" headerAlignment="left"
			rendered="#{MySession.hasOp['100401']==true}">
			<rich:tab id="tab1" name="tab1"
				label="#{Lang.prop[MySession.l]['list']}">
				<a4j:form id="searchForm">
					<h:outputText value="#{Lang.prop[MySession.l]['username']}:" />
					<h:inputText id="key" value="#{MySession.tempStr['User.key']}"
						style="width:80px;" />
					<h:outputText value="#{Lang.prop[MySession.l]['displayname']}:" />
					<h:inputText id="key2" value="#{MySession.tempStr['User.key2']}"
						style="width:80px;" />
					<a4j:commandLink action="#{User.buildRecordsList}"
						reRender="dataForm">
						<h:outputText value="#{Lang.prop[MySession.l]['search']}"
							class="btn" />
					</a4j:commandLink>
					<a4j:commandLink style="margin-left:6px;"
						onclick="$('searchForm:key').value='';$('searchForm:key2').value='';return false;">
						<h:outputText value="#{Lang.prop[MySession.l]['reset']}"
							class="btn" />
					</a4j:commandLink>
				</a4j:form>
				<a4j:form id="dataForm" style="margin-top:3px;">
					<rich:dataTable id="dataTable" rows="#{MySession.pageSize}"
						value="#{User.recordsList}" var="item" rowKeyVar="rowNum"
						style="width:100%;">
						<f:facet name="header">
							<rich:columnGroup>
								<rich:column styleClass="left">
									<h:outputText value="" />
								</rich:column>
								<rich:column>
									<h:outputText value="#{Lang.prop[MySession.l]['operation']}" />
								</rich:column>
								<rich:column>
									<h:outputText value="#{Lang.prop[MySession.l]['department']}" />
								</rich:column>
								<rich:column>
									<h:outputText value="#{Lang.prop[MySession.l]['username']}" />
								</rich:column>
								<rich:column>
									<h:outputText value="#{Lang.prop[MySession.l]['displayname']}" />
								</rich:column>
								<rich:column>
									<h:outputText value="#{Lang.prop[MySession.l]['gender']}" />
								</rich:column>
								<rich:column>
									<h:outputText value="#{Lang.prop[MySession.l]['email']}" />
								</rich:column>
								<rich:column>
									<h:outputText value="#{Lang.prop[MySession.l]['mobilephone']}" />
								</rich:column>
								<rich:column styleClass="right">
									<h:outputText value="#{Lang.prop[MySession.l]['islock']}" />
								</rich:column>
							</rich:columnGroup>
						</f:facet>
						<rich:column style="text-align:center;width:21px;">
							<h:outputText value="#{rowNum + 1}" />
						</rich:column>
						<rich:column
							style="text-align:center;white-space:nowrap;width:42px;">
							<a4j:commandLink reRender="editPanel">
								<h:graphicImage id="edit"
									onclick="RichFaces.switchTab('tab','tab2','tab2');"
									title="#{Lang.prop[MySession.l]['edit']}" class="imgBtn"
									url="images/edit.png">
								</h:graphicImage>
								<f:param name="id" value="#{item.prop['id']}" />
								<f:param name="relationId" value="#{item.prop['id']}" />
								<f:param name="type" value="user" />
								<f:param name="reload" value="false" />
							</a4j:commandLink>
							<a4j:commandLink action="#{User.showDialog}"
								rendered="#{MySession.hasOp['100402']==true}"
								onclick="#{rich:component('mpForConfirm')}.show();hideObject('dataForm:dataTable:#{rowNum}:edit');hideObject('dataForm:dataTable:#{rowNum}:del');">
								<h:graphicImage id="del"
									title="#{Lang.prop[MySession.l]['delete']}" class="imgBtn"
									url="images/delete.png">
								</h:graphicImage>
								<f:param name="id" value="#{item.prop['id']}" />
								<f:param name="reload" value="false" />
							</a4j:commandLink>
						</rich:column>
						<rich:column style="width:136px;text-align:left;">
							<h:outputText value="#{item.prop['depaName']}" />
						</rich:column>
						<rich:column style="width:100px;text-align:center;">
							<h:outputText value="#{item.prop['userName']}" />
						</rich:column>
						<rich:column style="width:120px;text-align:center;">
							<h:outputText value="#{item.prop['displayName']}" />
						</rich:column>
						<rich:column style="width:60px;text-align:center;">
							<h:outputText value="#{Lang.prop[MySession.l]['male']}"
								rendered="#{item.prop['gender']=='1'}" />
							<h:outputText value="#{Lang.prop[MySession.l]['female']}"
								rendered="#{item.prop['gender']=='0'}" />
						</rich:column>
						<rich:column style="width:160px;text-align:center;">
							<h:outputText value="#{item.prop['email']}" />
						</rich:column>
						<rich:column style="width:100px;text-align:center;">
							<h:outputText value="#{item.prop['mobilePhone']}" />
						</rich:column>
						<rich:column style="width:60px;text-align:center;">
							<h:outputText value="#{Lang.prop[MySession.l]['yes']}"
								rendered="#{item.prop['isLock']=='1'}" />
							<h:outputText value="#{Lang.prop[MySession.l]['no']}"
								rendered="#{item.prop['isLock']=='0'}" />
						</rich:column>
					</rich:dataTable>
					<rich:dataTable id="dsTable" rows="#{MySession.pageSize}"
						value="#{User.dsList}" var="item" style="width:100%;"
						reRender="ds">
						<ui:include src="ds.xhtml" />
					</rich:dataTable>
				</a4j:form>
			</rich:tab>
			<rich:tab id="tab2" name="tab2"
				label="#{Lang.prop[MySession.l]['edit']}">
				<a4j:outputPanel id="editPanel">
					<h:outputText value="#{User.init}" style="display:none;" />
					<fieldset class="fieldset"><legend> <h:outputText
						value="#{Lang.prop[MySession.l]['property']}" /> </legend> <a4j:form
						id="editForm">
						<h:panelGrid columns="3" columnClasses="co1,co2,co3">
							<h:outputText value="#{Lang.prop[MySession.l]['username']}:" />
							<h:inputText value="#{User.prop['userName']}" style="width:80px;" />
							<h:outputText value="*" />

							<h:outputText value="#{Lang.prop[MySession.l]['password']}:" />
							<h:inputSecret value="#{User.prop['password']}"
								style="width:80px;" />
							<h:outputText value="*" />

							<h:outputText value="#{Lang.prop[MySession.l]['displayname']}:" />
							<h:inputText value="#{User.prop['displayName']}"
								style="width:80px;" />
							<h:outputText value="*" />

							<h:outputText value="#{Lang.prop[MySession.l]['department']}:" />
							<h:panelGrid columns="2">
								<h:outputText id="departmentName"
									value="#{MySession.tempStr['Department.depaName']}" />
								<rich:simpleTogglePanel opened="false" id="departmenttree"
									switchType="client" label="...">
									<ui:include src="departmenttree.xhtml" />
								</rich:simpleTogglePanel>
							</h:panelGrid>
							<h:outputText value="*" />

							<h:outputText value="#{Lang.prop[MySession.l]['job']}:" />
							<h:panelGrid columns="2">
								<h:outputText id="jobName"
									value="#{MySession.tempStr['Job.jobName']}" />
								<rich:simpleTogglePanel opened="false" id="jobtree"
									switchType="client" label="...">
									<ui:include src="jobtree.xhtml" />
								</rich:simpleTogglePanel>
							</h:panelGrid>
							<h:outputText value="*" />

							<h:outputText value="#{Lang.prop[MySession.l]['job']}:" />
							<h:panelGrid columns="2">
								<h:outputText id="jobName2"
									value="#{MySession.tempStr['Job.jobName2']}" />
								<rich:simpleTogglePanel opened="false" id="jobtree2"
									switchType="client" label="...">
									<ui:include src="jobtree2.xhtml" />
								</rich:simpleTogglePanel>
							</h:panelGrid>
							<h:outputText value="" />

							<h:outputText value="#{Lang.prop[MySession.l]['phone']}:" />
							<h:inputText value="#{User.prop['phone']}" style="width:80px;" />
							<h:outputText value="" />

							<h:outputText value="#{Lang.prop[MySession.l]['mobilephone']}:" />
							<h:inputText value="#{User.prop['mobilePhone']}"
								style="width:80px;" />
							<h:outputText value="" />

							<h:outputText value="#{Lang.prop[MySession.l]['email']}:" />
							<h:inputText value="#{User.prop['email']}" style="width:200px;" />
							<h:outputText value="" />

							<h:outputText value="#{Lang.prop[MySession.l]['gender']}:" />
							<h:selectOneRadio value="#{User.prop['gender']}">
								<f:selectItem itemValue="1"
									itemLabel="#{Lang.prop[MySession.l]['male']}" />
								<f:selectItem itemValue="0"
									itemLabel="#{Lang.prop[MySession.l]['female']}" />
							</h:selectOneRadio>
							<h:outputText value="" />

							<h:outputText value="#{Lang.prop[MySession.l]['islock']}:" />
							<h:selectOneRadio value="#{User.prop['isLock']}">
								<f:selectItem itemValue="1"
									itemLabel="#{Lang.prop[MySession.l]['yes']}" />
								<f:selectItem itemValue="0"
									itemLabel="#{Lang.prop[MySession.l]['no']}" />
							</h:selectOneRadio>
							<h:outputText value="" />
							<h:outputText value="" />
							<h:panelGrid columns="2"
								rendered="#{MySession.hasOp['100402']==true}">
								<a4j:commandLink action="#{User.newRecord}" reRender="msg">
									<h:outputText class="btn"
										value="#{Lang.prop[MySession.l]['newrecord']}" />
									<f:param name="redirect" value="false" />
									<f:param name="reload" value="false" />
								</a4j:commandLink>
								<a4j:commandLink action="#{User.updateRecordById}"
									reRender="msg">
									<h:outputText class="btn"
										value="#{Lang.prop[MySession.l]['save']}" />
									<f:param name="redirect" value="false" />
									<f:param name="reload" value="false" />
									<f:param name="id" value="#{param['id']}" />
								</a4j:commandLink>
							</h:panelGrid>
							<h:outputText value="" />
						</h:panelGrid>
					</a4j:form></fieldset>
					<fieldset class="fieldset"><legend> <h:outputText
						value="#{Lang.prop[MySession.l]['rolelist']}" /> </legend> <a4j:form
						id="relationForm"
						rendered="#{param['relationId'] gt 0 and MySession.hasOp['100402']==true}">
						<h:panelGrid columns="3">
							<h:outputText value="#{Lang.prop[MySession.l]['role']}:" />
							<rich:comboBox value="#{RoleUserRelation.roleName}"
								suggestionValues="#{Application.roleList}"
								style="width:60px;margin-top:-6px;">
							</rich:comboBox>
							<a4j:commandLink action="#{RoleUserRelation.newRecord}"
								reRender="relationDataTable,msg" style="margin-left:90px;">
								<h:outputText class="btn"
									value="#{Lang.prop[MySession.l]['join']}" />
								<f:param name="type" value="user" />
								<f:param name="relationId" value="#{param['relationId']}" />
							</a4j:commandLink>
						</h:panelGrid>
					</a4j:form> <a4j:form id="relationDataForm"
						rendered="#{param['relationId'] gt 0 and MySession.hasOp['100402']==true}">
						<h:panelGrid columns="3" style="margin-top:3px;">
							<a4j:commandLink onclick="javascript:selectAll();return false;">
								<h:outputText class="btn"
									value="#{Lang.prop[MySession.l]['selectall']}" />
							</a4j:commandLink>
							<a4j:commandLink onclick="javascript:selectNone();return false;">
								<h:outputText class="btn"
									value="#{Lang.prop[MySession.l]['selectnone']}" />
							</a4j:commandLink>
							<a4j:commandLink reRender="confirmDialog"
								action="#{RoleUserRelation.showDialog}"
								onclick="#{rich:component('mpForConfirm2')}.show();">
								<h:outputText class="btn"
									value="#{Lang.prop[MySession.l]['deleteselected']}" />
								<f:param name="reload" value="false" />
								<f:param name="type" value="user" />
								<f:param name="relationId" value="#{param['relationId']}" />
							</a4j:commandLink>
						</h:panelGrid>
						<rich:dataGrid id="relationDataTable"
							value="#{RoleUserRelation.recordsList}" var="item" columns="5">
							<h:selectBooleanCheckbox
								value="#{RoleUserRelation.checkIdsMap[item.ID_]}">
							</h:selectBooleanCheckbox>
							<h:outputText value="#{item.roleName}" />
						</rich:dataGrid>
					</a4j:form></fieldset>
				</a4j:outputPanel>
			</rich:tab>
		</rich:tabPanel>
		<a4j:form>
			<rich:modalPanel id="mpForConfirm" width="300" height="80"
				zindex="3000"
				style="background:url(images/warning.png) no-repeat 8px 12px #fcfae9;background-image:url(images/warning.png)">
				<a4j:outputPanel style="width:250px;margin-top:-10px;height:80px;">
					<h:panelGrid columns="3">
						<h:outputText value="#{Lang.prop[MySession.l]['deletewarning']}"
							style="font-size:11pt;" />
						<a4j:commandLink reRender="msg" action="#{User.deleteRecordById}"
							onclick="#{rich:component('mpForConfirm')}.hide()">
							<h:outputText class="btn" value="#{Lang.prop[MySession.l]['ok']}" />
							<f:param name="reload" value="false" />
						</a4j:commandLink>
						<a4j:commandLink
							onclick="#{rich:component('mpForConfirm')}.hide()">
							<h:outputText class="btn"
								value="#{Lang.prop[MySession.l]['cancel']}" />
						</a4j:commandLink>
					</h:panelGrid>
				</a4j:outputPanel>
			</rich:modalPanel>
		</a4j:form>
		<a4j:form>
			<rich:modalPanel id="mpForConfirm2" width="300" height="80"
				zindex="3001"
				style="clear:both;background:url(images/warning.png) no-repeat 8px 12px #fcfae9;background-image:url(images/warning.png)">
				<a4j:outputPanel id="confirmDialog"
					style="width:250px;margin-top:-10px;height:80px;">
					<h:panelGrid columns="3">
						<h:outputText value="#{Lang.prop[MySession.l]['deletewarning']}"
							style="font-size:11pt;" />
						<a4j:commandLink reRender="relationDataTable,msg"
							action="#{RoleUserRelation.deleteRecords}"
							onclick="#{rich:component('mpForConfirm2')}.hide()">
							<h:outputText class="btn" value="#{Lang.prop[MySession.l]['ok']}" />
							<f:param name="reload" value="false" />
							<f:param name="type" value="user" />
							<f:param name="relationId"
								value="#{MySession.tempStr['RoleUserRelation.relationId']}" />
						</a4j:commandLink>
						<a4j:commandLink
							onclick="#{rich:component('mpForConfirm2')}.hide()">
							<h:outputText class="btn"
								value="#{Lang.prop[MySession.l]['cancel']}" />
						</a4j:commandLink>
					</h:panelGrid>
				</a4j:outputPanel>
			</rich:modalPanel>
		</a4j:form>
	</ui:define>
</ui:composition>
</html>